﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using KPIS.GERP.GIMS.MODEL;
using KPIS.GERP.GIMS.DAL;
using KPIS.GERP.GIMS.DALFactory;

namespace KPIS.GERP.GIMS.BLL
{
    public class SysControlBLL
    {
        private static readonly SysControlDAL dal = DataAccess.CreateSysControl();

        public SysControlInfo GetDefaultData()
        {
            return dal.GetDefaultData();
        }

        public string FormatBuddhistDate(string date)
        {
            string strResult;
            string[] date_value = date.Split('/');
            string day = date_value[0];
            string month = date_value[1];
            string year = date_value[2].Substring(0, 4);

            switch (month)
            {
                case "1":
                    month = "มกราคม";
                    break;
                case "2":
                    month = "กุมภาพันธ์";
                    break;
                case "3":
                    month = "มีนาคม";
                    break;
                case "4":
                    month = "เมษายน";
                    break;
                case "5":
                    month = "พฤษภาคม";
                    break;
                case "6":
                    month = "มิถุนายน";
                    break;
                case "7":
                    month = "กรกฎาคม";
                    break;
                case "8":
                    month = "สิงหาคม";
                    break;
                case "9":
                    month = "กันยายน";
                    break;
                case "10":
                    month = "ตุลาคม";
                    break;
                case "11":
                    month = "พฤศจิกายน";
                    break;
                case "12":
                    month = "ธันวาคม";
                    break;
            }

            strResult = day + " " + month + " " + year;
            return strResult;
        }
    }
}
